package com.macro.mall.tiny.controller;

import com.macro.mall.tiny.common.api.CommonResult;
import com.macro.mall.tiny.mbg.model.UmsMember;
import com.macro.mall.tiny.service.UmsMemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@Api(tags = "UmsMemberController",description = "会员登录注册管理端")
@RequestMapping("/sso")
public class UmsMemberController {
   @Autowired
   private UmsMemberService umsMemberService;


   @ApiOperation("获取验证码")
   @RequestMapping(value = "/getAuthCode",method = RequestMethod.GET)
   @ResponseBody
   public CommonResult getAuthCode(@RequestParam String telephone){
       return umsMemberService.generateAuthCode(telephone);
   }

    @ApiOperation("判断验证码是否正确")
    @RequestMapping(value = "/verifyAuthCode",method = RequestMethod.POST)
    @ResponseBody
    public CommonResult UpdatePassword(@RequestParam String telephone,@RequestParam String authCoded){
        return umsMemberService.verifyAuthCode(telephone,authCoded);
    }
}
